package com.hky.algorithm.controller;

import com.hky.algorithm.realize.Game;
import com.hky.algorithm.realize.Player;
import com.hky.algorithm.service.PageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Controller
public class PageController {

    @Autowired
    private PageService pageService;

    @GetMapping("/toIndex")
    public String toIndex() {
        return "index.html";
    }

    @ResponseBody
    @PostMapping("/ajax")
    public Game ajax(@RequestBody Game game){
        pageService.calculate(game);
        return game;
    }
}
